package com.galeno;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author galeno
 * @Title:
 * @Description:
 * @date 2021/10/2020:41
 */
public class FlinkUtils2 {
    /**
     *
     * @param port 本地web端的端口号
     * @return 返回一个DateStreamSource集合
     */
    public static DataStreamSource<String> getDs(int port){

        return getEnv().socketTextStream("192.168.77.101", 8888);
    }
    public static StreamExecutionEnvironment getEnv(){
        Configuration configuration = new Configuration();
        configuration.setInteger("rest.port",10086);
        return StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(configuration);
    }

    public static void exec() throws Exception {
        getEnv().execute();
    }
}
